

ALTER  proc sp_save_customer_shipping_lot_number_data
@cslit_id int,
@lot_id bigint,
@qty_pulled int
As
begin
	declare @count int
	select @count = count(*) from Customer_Shipping_Lot_Number_Table where Lot_ID = @lot_id AND CSLIT_ID = @cslit_id

	if @count is null or @count = 0	-- INSERT
	begin
		INSERT INTO Customer_Shipping_Lot_Number_Table (CSLIT_ID, Lot_ID, CSLNT_Qty_Pull) VALUES (@cslit_id, @lot_id, @qty_pulled)
	end

	else -- UPDATE
	begin
		UPDATE Customer_Shipping_Lot_Number_Table SET CSLNT_Qty_Pull = @qty_pulled WHERE Lot_ID = @lot_id  AND CSLIT_ID = @cslit_id 
	end
end


